import { obj_float, obj_str } from 'sui';

const get_qr = (d) => {
    const kia = obj_str(d, "kia");
    const sia = obj_str(d, "sia");
    const kea = obj_str(d, "kea");
    const sea = obj_str(d, "sea");

    let india = obj_float(d, "india");
    if (india >= 0) {
        india = `+${india}`;
    }

    let standout = obj_float(d, "standout");
    if (standout >= 0) {
        standout = `+${standout}`;
    }

    let dent = obj_float(d, "dent");
    if (dent >= 0) {
        dent = `+${dent}`;
    }

    return `${d.sn}${d.outdia}${india}${d.outwidth}${standout}${dent}${d.angle}${kia}${sia}${kea}${sea}`;
};

const get_qr_b = (d) => {
    const kia = obj_str(d, "kia");
    const sia = obj_str(d, "sia");
    const kea = obj_str(d, "kea");
    const sea = obj_str(d, "sea");

    return `${d.sn}${d.outdia}${d.india}${d.outwidth}${d.angle}${kia}${sia}${kea}${sea}`;
};

export {get_qr_b, get_qr};
